import base64
import datetime
import hashlib
import hmac
import json
import random
import time
import urllib.parse

import pymysql
import requests

from apscheduler.schedulers.background import BackgroundScheduler


# https://www.jinrishici.com/
def jinrishici():
    url = 'https://v2.jinrishici.com/sentence'
    headers = {"X-User-Token": "lhxcBUYSfbpezLqtSbLn2vqBUbWDriT8", }
    r = requests.get(url, headers=headers)
    res = json.loads(r.text)
    print(res)
    return '## 今日诗词：' + res['data']['content']


# https://www.zhai78.com/
def jitang():
    url = 'https://data.zhai78.com/openOneGood.php'
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    return '## 鸡汤：' + res['txt']


# https://www.zhai78.com/
def dujitang():
    url = 'https://data.zhai78.com/openOneBad.php'
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    return '## 毒鸡汤：' + res['txt']


# http://open.iciba.com/index.php?c=wiki
def ciba():
    url = 'http://open.iciba.com/dsapi/?date='
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    return '## 金山词霸：' + res['content']


# http://api.youngam.cn/
# 失效了
def one():
    url = 'http://api.youngam.cn/api/one.php'
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    return res['data'][0]['text']


# https://hitokoto.cn/
def oneNew():
    url = 'https://v1.hitokoto.cn/'
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    return '## 一言：' + res['hitokoto']


prev_one = 0


def random_one():
    num = random.randint(1, 5)
    global prev_one
    while num == prev_one:
        num = random.randint(1, 5)
    try:
        if num == 1:
            send_to_ding('## 下班了，不要忘记订餐、禅道、打卡\n' + jinrishici())
        elif num == 2:
            send_to_ding('## 下班了，不要忘记订餐、禅道、打卡\n' + jitang())
        elif num == 3:
            send_to_ding('## 下班了，不要忘记订餐、禅道、打卡\n' + dujitang())
        elif num == 4:
            send_to_ding('## 下班了，不要忘记订餐、禅道、打卡\n' + ciba())
        elif num == 5:
            send_to_ding('## 下班了，不要忘记订餐、禅道、打卡\n' + oneNew())
    except BaseException as e:
        print('BaseException:', e)
        random_one()
    prev_one = num


def send_to_ding(text, isAtAll=False):
    url = 'https://oapi.dingtalk.com/robot/send?access_token=9b9cf3d49cd37457089a44bb61a1401cb87234a369867172e418117624fa8ea4'
    timestamp = str(round(time.time() * 1000))
    secret = 'SEC67caa1c692c4742d3cc99118ad5612167a27730a7267d9db8e1f332af351d306'
    secret_enc = secret.encode('utf-8')
    string_to_sign = '{}\n{}'.format(timestamp, secret)
    string_to_sign_enc = string_to_sign.encode('utf-8')
    hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
    sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
    # print(timestamp)
    # print(sign)
    url = url + '&timestamp=' + timestamp + '&sign=' + sign
    # print(url)
    data = {
        'msgtype': 'markdown',
        'markdown': {
            "title": '_(:з」∠)_',
            'text': text
        },
        'at': {
            "atMobiles": [],
            "atUserIds": [],
            "isAtAll": True
        }
    }
    print(data)
    headers = {'Content-Type': 'application/json', }
    r = requests.post(url, data=json.dumps(data), headers=headers)
    res = json.loads(r.text)
    print(res)


# http://doc.tianqiapi.com/603579
def tianqi():
    url = 'https://tianqiapi.com/api?version=v6&appid=62132872&appsecret=iOYs4J9y'
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    # return res['city'] + ' ' + res['week'] + ' ' + res['wea'] + ' ' + res['tem1'] + '~' + res['tem2'] + '\n实时温度：' + res[
    #     'tem'] + ' ' + res['win'] + res['win_speed'] + '\n空气质量：' + res['air_level'] + '\n' + res['air_tips']
    # return res['city'] + ' ' + res['week'] + ' ' + res['wea'] + ' ' + res['tem1'] + '~' + res['tem2'] + '\n实时温度：' + res[
    #     'tem'] + ' ' + res['win'] + res['win_speed'] + '\n空气质量：' + res['air_level']
    return res['city'] + ' ' + res['week'] + '\n' + res['wea'] + ' ' + res['tem1'] + '~' + res['tem2'] + '\n空气质量：' + \
           res['air_level']


def tianqi_send():
    send_to_ding(tianqi())


def tianqi_send_fix():
    send_to_ding(tianqi() + '\n不要忘记考勤打卡、健康打卡~')


def dingcan():
    send_to_ding('忙碌的并且晚上要继续忙碌的小伙伴们，不要忘记订餐哟~', True)


def jihuazongjie():
    send_to_ding('计划总结！快！(╬￣皿￣)=○＃(￣＃)3￣)', True)


def gongjiancao():
    send_to_ding('快乐工作,健康生活！快去运动一下吧！', True)


def qiangfan():
    send_to_ding('人是铁饭是钢,一顿不吃饿得慌,取饭的时间又到了！\n领取地点：一楼大厅\n领取方式:拿起就跑,越快越好', True)


# https://www.jisuapi.com/debug/todayhistory/
def today_history():
    url = 'https://api.jisuapi.com/todayhistory/query?appkey=1141d77980c836d8'
    i = datetime.datetime.now()
    url += '&month=' + str(i.month)
    url += '&day=' + str(i.day)
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    res_list = res['result']
    res_str = '《历史上的今天》\n'
    if len(res_list) == 0:
        res_str += '┌(。Д。)┐今天没有历史...\n'
    for index in range(len(res_list)):
        res_str += str(index + 1) + '.' + res_list[index]['title'] + '\n'
    return res_str


def send_today_history():
    send_to_ding(today_history())


# https://www.jisuapi.com/debug/news/
def news():
    url = 'https://api.jisuapi.com/news/get?channel=头条&appkey=1141d77980c836d8'
    r = requests.get(url)
    res = json.loads(r.text)
    print(res)
    res_list = res['result']['list']
    res_str = '《午间新闻》\n'
    for index in range(len(res_list)):
        res_str += str(index + 1) + '.' + res_list[index]['title'] + '\n'
        res_str += '  ' + res_list[index]['weburl'] + '\n'
    return res_str


def send_news():
    send_to_ding(news())


def jiankangka():
    num = random.randint(1, 3)
    if num == 1:
        send_to_ding("## 安全放心肉,健康中国人。\n## 请在9：00前完成健康打卡！", True)
    elif num == 2:
        send_to_ding("## 健康鲜肉，日日肉鲜。\n## 请在9：00前完成健康打卡！", True)
    elif num == 3:
        send_to_ding("## 早发现，早报告，早隔离，早治疗。\n## 请在9：00前完成健康打卡！", True)


def nabiandaka():
    url = 'https://oapi.dingtalk.com/robot/send?access_token=54e0c21de9b50a1f7d364186bbbbf597d7660953c99e0afd511b8e4787aab2f1'
    timestamp = str(round(time.time() * 1000))
    secret = 'SECba4d0abb9d13f40a339748741b76a75352f97d084fa99dc8796be6af0c63a5f0'
    secret_enc = secret.encode('utf-8')
    string_to_sign = '{}\n{}'.format(timestamp, secret)
    string_to_sign_enc = string_to_sign.encode('utf-8')
    hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
    sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
    # print(timestamp)
    # print(sign)
    url = url + '&timestamp=' + timestamp + '&sign=' + sign
    # print(url)
    data = {
        'msgtype': 'markdown',
        'markdown': {
            "title": '天线宝宝',
            'text': '## 宝宝们打卡喽：\n## 1、健康打卡\n## 2、还要开启禅道呀'
        },
        'at': {
            "atMobiles": [],
            "atUserIds": [],
            "isAtAll": True
        }
    }
    print(data)
    headers = {'Content-Type': 'application/json', }
    r = requests.post(url, data=json.dumps(data), headers=headers)
    res = json.loads(r.text)
    print(res)


def dagongren():
    send_to_ding("累吗?累就对了，舒服是留给有钱人的!\n冷吗?冷就对了，温暖是留给开小轿车的人！\n世上有两种最耀眼的光芒，一种是太阳，一种是打工人努力的模样。\n明天见，打工人！", True)


def random_one_bye():
    num = random.randint(1, 5)
    global prev_one
    while num == prev_one:
        num = random.randint(1, 5)
    try:
        if num == 1:
            send_to_ding(jinrishici() + "\n明天见，打工人！", True)
        elif num == 2:
            send_to_ding(jitang() + "\n明天见，打工人！", True)
        elif num == 3:
            send_to_ding(dujitang() + "\n明天见，打工人！", True)
        elif num == 4:
            send_to_ding(ciba() + "\n明天见，打工人！", True)
        elif num == 5:
            send_to_ding(one() + "\n明天见，打工人！", True)
    except BaseException as e:
        print('BaseException:', e)
        random_one()
    prev_one = num


def liangongbao():
    send_to_ding("链工保，包练功\n安全隐患记心头，严抓细管不懈怠\n更有每日抽奖华为手机免费送", True)


def ribao():
    url = 'https://oapi.dingtalk.com/robot/send?access_token=8f1c0672ff67133a2b5faaa3189c2b13ff8ea44f5a68761558d651bd820ff24b'
    timestamp = str(round(time.time() * 1000))
    secret = 'SEC45ee179bf6d5dbb023406812a751eaba713c8c03d9e8a2d9a256f6966d24eb03'
    secret_enc = secret.encode('utf-8')
    string_to_sign = '{}\n{}'.format(timestamp, secret)
    string_to_sign_enc = string_to_sign.encode('utf-8')
    hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
    sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
    # print(timestamp)
    # print(sign)
    url = url + '&timestamp=' + timestamp + '&sign=' + sign
    # print(url)
    data = {
        'msgtype': 'text',
        'text': {
            'content': "日报周报月报年报，报报惊心\n骈文韵文散文序文，文文拼凑\n今天你报了么！?"
        },
        'at': {
            "atMobiles": [],
            "isAtAll": True
        }
    }
    print(data)
    headers = {'Content-Type': 'application/json', }
    r = requests.post(url, data=json.dumps(data), headers=headers)
    res = json.loads(r.text)
    print(res)


def acm():
    doCenterSonar(
        'https://oapi.dingtalk.com/robot/send?access_token=276be32a16d7b5fd1e8581f5d3a406fc9b4d30aea7ff7bd9ae141f479a72780c',
        'SECf99a45f77d74d30425650a7bdbef2b16dee025532f1fe177e7bb712b4ce5725e', 'saf-acm-base-be')


def iam():
    doCenterSonar(
        'https://oapi.dingtalk.com/robot/send?access_token=276be32a16d7b5fd1e8581f5d3a406fc9b4d30aea7ff7bd9ae141f479a72780c',
        'SECf99a45f77d74d30425650a7bdbef2b16dee025532f1fe177e7bb712b4ce5725e', 'saf-acm-iam-be')


def fed():
    doCenterSonar(
        'https://oapi.dingtalk.com/robot/send?access_token=d5e960cce653c4dd6535bf14dc4205b2efde81cc26897d62b6ad19c1ec412085',
        'SECcf5e8ef3bef51e7bdfe2926143d9c7ed8d614c7d5886f9640a58994c00de7c48', 'saf-fmc-fed-be')


def fps():
    doCenterSonar(
        'https://oapi.dingtalk.com/robot/send?access_token=d5e960cce653c4dd6535bf14dc4205b2efde81cc26897d62b6ad19c1ec412085',
        'SECcf5e8ef3bef51e7bdfe2926143d9c7ed8d614c7d5886f9640a58994c00de7c48', 'saf-fmc-fps-be')


def dac():
    doCenterSonar(
        'https://oapi.dingtalk.com/robot/send?access_token=05a87a4073b565982f13ad14ef67c974b23e86d303b086f0f32e287afbb29cc5',
        'SEC47f5700ba8eeeb88a2fe896516c468ea4019e465dfdaaf0b72612b314d2c9991', 'saf-fis-dac-be')


def doCenterSonar(url, secret, project):
    timestamp = str(round(time.time() * 1000))
    secret_enc = secret.encode('utf-8')
    string_to_sign = '{}\n{}'.format(timestamp, secret)
    string_to_sign_enc = string_to_sign.encode('utf-8')
    hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
    sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
    url = url + '&timestamp=' + timestamp + '&sign=' + sign
    # print(url)
    sq_str = sonarQube(project)
    data = {
        'msgtype': 'markdown',
        'markdown': {
            "title": project,
            'text': sq_str
        },
        'at': {
            "atMobiles": [],
            "atUserIds": [],
            "isAtAll": True
        }
    }
    print(data)
    headers = {'Content-Type': 'application/json', }
    r = requests.post(url, data=json.dumps(data), headers=headers)
    res = json.loads(r.text)
    print(res)


def sonarQube(project):
    bug_count = ''
    vul_count = ''
    gs_count = ''
    url1 = 'http://10.133.5.59:9000/api/issues/search?componentKeys=' + project + '&resolved=false&types=BUG%2CVULNERABILITY&facets=severities%2Ctypes&timeZone=Asia%2FShanghai'
    r1 = requests.get(url1)
    res1 = json.loads(r1.text)
    list1 = res1['facets'][1]['values']
    for item in list1:
        if item['val'] == 'BUG':
            bug_count = item['count']
        elif item['val'] == 'VULNERABILITY':
            vul_count = item['count']
    url2 = 'http://10.133.5.59:9000/api/issues/search?componentKeys=' + project + '&resolved=false&severities=BLOCKER%2CCRITICAL&types=CODE_SMELL&facets=severities%2Ctypes&timeZone=Asia%2FShanghai'
    r2 = requests.get(url2)
    res2 = json.loads(r2.text)
    list2 = res2['facets'][1]['values']
    for item in list2:
        if item['val'] == 'CODE_SMELL':
            gs_count = item['count']

    date = time.strftime("%Y-%m-%d", time.localtime())

    # 1.连接
    conn = pymysql.connect(host='10.133.5.59', port=3306, user='root', password='1986z11z20Z!', db='vrrhelp',
                           charset='utf8')
    # conn.select_db('vrrhelp')
    # 2.创建游标
    cur = conn.cursor()

    sql3 = 'insert into sonarstat(date,project,bug_count,vul_count,gs_count) values(%s,%s,%s,%s,%s)'
    effect_row = cur.execute(sql3,
                             (date + ' am', project, str(bug_count), str(vul_count), str(gs_count)))  # effect_row=1

    # 一定记得commit
    conn.commit()
    # 4.关闭游标
    cur.close()
    # 5.关闭连接
    conn.close()


    if bug_count == 0 and vul_count == 0 and gs_count == 0:
        return '# ' + project + '暂无sonarQube问题 (ง •̀_•́)ง'
    else:
        buildStr = '# ' + project + '昨日产生sonarQube问题\n'
        buildStr += '## bug：' + str(bug_count) + ' 漏洞：' + str(vul_count) + '\n'
        # for item in res1['issues']:
        #     buildStr += '> component:' + item['component'] + ' author:' + item['author'] + '\n'
        buildStr += '## 异味（阻断、严重）：' + str(gs_count) + '\n'
        # for item in res2['issues']:
        #     buildStr += '> component:' + item['component'] + ' author:' + item['author'] + '\n'
        return buildStr


def acm_day():
    projectView(
        'https://oapi.dingtalk.com/robot/send?access_token=276be32a16d7b5fd1e8581f5d3a406fc9b4d30aea7ff7bd9ae141f479a72780c',
        'SECf99a45f77d74d30425650a7bdbef2b16dee025532f1fe177e7bb712b4ce5725e', '资产业务', 'saf-acm-base-be',
        'saf-acm-base-fe')


def iam_day():
    projectView(
        'https://oapi.dingtalk.com/robot/send?access_token=276be32a16d7b5fd1e8581f5d3a406fc9b4d30aea7ff7bd9ae141f479a72780c',
        'SECf99a45f77d74d30425650a7bdbef2b16dee025532f1fe177e7bb712b4ce5725e', '资产实物', 'saf-acm-iam-be',
        'saf-acm-iam-fe')


def fed_day():
    projectView(
        'https://oapi.dingtalk.com/robot/send?access_token=d5e960cce653c4dd6535bf14dc4205b2efde81cc26897d62b6ad19c1ec412085',
        'SECcf5e8ef3bef51e7bdfe2926143d9c7ed8d614c7d5886f9640a58994c00de7c48', '外汇及金融衍生', 'saf-fmc-fed-be',
        'saf-fmc-fed-fe')


def fps_day():
    projectView(
        'https://oapi.dingtalk.com/robot/send?access_token=d5e960cce653c4dd6535bf14dc4205b2efde81cc26897d62b6ad19c1ec412085',
        'SECcf5e8ef3bef51e7bdfe2926143d9c7ed8d614c7d5886f9640a58994c00de7c48', '资金池监管', 'saf-fmc-fps-be',
        'saf-fmc-fps-fe')


def dac_day():
    projectView(
        'https://oapi.dingtalk.com/robot/send?access_token=05a87a4073b565982f13ad14ef67c974b23e86d303b086f0f32e287afbb29cc5',
        'SEC47f5700ba8eeeb88a2fe896516c468ea4019e465dfdaaf0b72612b314d2c9991', '分析中心', 'saf-fis-dac-be',
        'saf-fis-dac-fe')


def com_day():
    projectView(
        'https://oapi.dingtalk.com/robot/send?access_token=e52e8ddade05d59636365b624e678cc448ad7f361bbe91474e65a4d53e280cad',
        'SEC0f4178f5e4e0c6593bd15bb9439ee2d04fd6f171cde942b21724286316abf0ec', '获利分析', 'saf-com-base-be',
        'saf-com-base-fe')


def projectView(url, secret, project, project1, project2):
    timestamp = str(round(time.time() * 1000))
    secret_enc = secret.encode('utf-8')
    string_to_sign = '{}\n{}'.format(timestamp, secret)
    string_to_sign_enc = string_to_sign.encode('utf-8')
    hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
    sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
    url = url + '&timestamp=' + timestamp + '&sign=' + sign
    # print(url)
    sq_str = projectViewMD(project, project1, project2)
    data = {
        'msgtype': 'markdown',
        'markdown': {
            "title": project,
            'text': sq_str
        },
        'at': {
            "atMobiles": [],
            "atUserIds": [],
            "isAtAll": True
        }
    }
    print(data)
    headers = {'Content-Type': 'application/json', }
    r = requests.post(url, data=json.dumps(data), headers=headers)
    res = json.loads(r.text)
    print(res)


def projectViewMD(project, project1, project2):
    bug_count = ''
    vul_count = ''
    gs_count = ''
    url1 = 'http://10.133.5.59:9000/api/issues/search?componentKeys=' + project1 + '&resolved=false&types=BUG%2CVULNERABILITY&facets=severities%2Ctypes&timeZone=Asia%2FShanghai'
    r1 = requests.get(url1)
    res1 = json.loads(r1.text)
    list1 = res1['facets'][1]['values']
    for item in list1:
        if item['val'] == 'BUG':
            bug_count = item['count']
        elif item['val'] == 'VULNERABILITY':
            vul_count = item['count']

    url2 = 'http://10.133.5.59:9000/api/issues/search?componentKeys=' + project1 + '&resolved=false&severities=BLOCKER%2CCRITICAL&types=CODE_SMELL&facets=severities%2Ctypes&timeZone=Asia%2FShanghai'
    r2 = requests.get(url2)
    res2 = json.loads(r2.text)
    list2 = res2['facets'][1]['values']
    for item in list2:
        if item['val'] == 'CODE_SMELL':
            gs_count = item['count']

    url3 = 'http://10.133.5.59:9000/api/measures/component?component=' + project1 + '&metricKeys=ncloc%2Cncloc_language_distribution'
    r3 = requests.get(url3)
    res3 = json.loads(r3.text)
    list3 = res3['component']['measures']
    for item in list3:
        if item['metric'] == 'ncloc':
            beline = item['value']

    url4 = 'http://10.133.5.59:9000/api/measures/component?component=' + project2 + '&metricKeys=ncloc%2Cncloc_language_distribution'
    r4 = requests.get(url4)
    res4 = json.loads(r4.text)
    list4 = res4['component']['measures']
    for item in list4:
        if item['metric'] == 'ncloc':
            feline = item['value']

    date = time.strftime("%Y-%m-%d", time.localtime())

    # 1.连接
    conn = pymysql.connect(host='10.133.5.59', port=3306, user='root', password='1986z11z20Z!', db='vrrhelp',
                           charset='utf8')
    # conn.select_db('vrrhelp')
    # 2.创建游标
    cur = conn.cursor()

    sql1 = 'select IFNULL(sum(addnum),0),IFNULL(sum(subnum),0),IFNULL(sum(totalnum),0) from gitstat where date = %s and project = %s'
    effect_row1 = cur.execute(sql1, (date, project1))
    rows1 = cur.fetchall()
    add1 = int(rows1[0][0])
    sub1 = int(rows1[0][1])
    total1 = int(rows1[0][2])

    sql2 = 'select IFNULL(sum(addnum),0),IFNULL(sum(subnum),0),IFNULL(sum(totalnum),0) from gitstat where date = %s and project = %s'
    effect_row2 = cur.execute(sql2, (date, project2))
    rows2 = cur.fetchall()
    add2 = int(rows2[0][0])
    sub2 = int(rows2[0][1])
    total2 = int(rows2[0][2])

    sql3 = 'insert into sonarstat(date,project,bug_count,vul_count,gs_count) values(%s,%s,%s,%s,%s)'
    effect_row = cur.execute(sql3,
                             (date + ' pm', project1, str(bug_count), str(vul_count), str(gs_count)))  # effect_row=1

    # 一定记得commit
    conn.commit()
    # 4.关闭游标
    cur.close()
    # 5.关闭连接
    conn.close()

    buildStr = '# ' + project + ' ' + date + ' 日报\n'
    buildStr += '## 代码扫描 bug：' + str(bug_count) + ' 漏洞：' + str(vul_count) + ' 异味（阻断、严重）：' + str(gs_count) + '\n'
    buildStr += '## 后端有效代码行:' + beline + '\n'
    buildStr += '### 今日变化 新增:' + str(add1) + ' 减少:' + str(sub1) + ' 合计:' + str(total1) + '\n'
    buildStr += '## 前端有效代码行:' + feline + '\n'
    buildStr += '### 今日变化 新增:' + str(add2) + ' 减少:' + str(sub2) + ' 合计:' + str(total2) + '\n'
    buildStr += '[sonar后端详细](http://10.133.5.59:9000/dashboard?id=' + project1 + ')\n'
    buildStr += '[sonar前端详细](http://10.133.5.59:9000/dashboard?id=' + project2 + ')\n'
    buildStr += '[7日代码量统计](http://10.133.5.58:16666/gitstatlist)\n'

    return buildStr


if __name__ == '__main__':
    scheduler = BackgroundScheduler()
    # scheduler.add_job(send_today_history, 'cron', day_of_week='mon-fri', hour='7', minute='30')
    # scheduler.add_job(tianqi_send_fix, 'cron', day_of_week='mon-fri', hour='8', minute='00')
    # scheduler.add_job(liangongbao, 'cron', hour='8', minute='00')
    scheduler.add_job(nabiandaka, 'cron', hour='8', minute='10')
    scheduler.add_job(nabiandaka, 'cron', hour='8', minute='20')
    scheduler.add_job(jiankangka, 'cron', hour='8', minute='30')
    # scheduler.add_job(acm, 'cron', hour='9', minute='00')
    # scheduler.add_job(iam, 'cron', hour='9', minute='00')
    scheduler.add_job(fed, 'cron', hour='9', minute='00')
    scheduler.add_job(fps, 'cron', hour='9', minute='00')
    scheduler.add_job(dac, 'cron', hour='9', minute='00')
    # scheduler.add_job(jihuazongjie, 'cron', day_of_week='fri', hour='9', minute='00')
    # scheduler.add_job(gongjiancao, 'cron', day_of_week='mon-fri', hour='9', minute='40')
    # scheduler.add_job(random_one, 'cron', day_of_week='mon-fri', hour='11', minute='30')
    # scheduler.add_job(send_news, 'cron', day_of_week='mon-fri', hour='12', minute='30')
    # scheduler.add_job(jihuazongjie, 'cron', day_of_week='fri', hour='13', minute='00')
    # scheduler.add_job(dingcan, 'cron', day_of_week='mon-fri', hour='14', minute='00')
    # scheduler.add_job(jiankangka, 'cron', hour='14', minute='10')
    # scheduler.add_job(jiankangkafin, 'cron', hour='16', minute='20')
    # scheduler.add_job(gongjiancao, 'cron', day_of_week='mon-fri', hour='14', minute='40')
    # scheduler.add_job(ribao, 'cron', day_of_week='mon-fri', hour='15', minute='50')
    # scheduler.add_job(acm_day, 'cron', hour='16', minute='30')
    # scheduler.add_job(iam_day, 'cron', hour='16', minute='30')
    scheduler.add_job(fed_day, 'cron', hour='16', minute='30')
    scheduler.add_job(fps_day, 'cron', hour='16', minute='30')
    scheduler.add_job(dac_day, 'cron', hour='16', minute='30')
    # scheduler.add_job(com_day, 'cron', day_of_week='mon-fri', hour='16', minute='30')
    # scheduler.add_job(random_one, 'cron', day_of_week='mon-fri', hour='19', minute='30')
    # scheduler.add_job(qiangfan, 'cron', day_of_week='mon-fri', hour='17', minute='20')
    # scheduler.add_job(dagongren, 'cron', day_of_week='mon-fri', hour='19', minute='50')
    # scheduler.add_job(random_one_bye, 'cron', day_of_week='mon-fri', hour='19', minute='55')
    scheduler.start()

    while True:
        # print(time.time())
        time.sleep(1)
